Use the procedure below to obtain pc sampling information. Also refer to Figure 4-1, which illustrates how pc sampling works.
% cc -c myprog.c
% cc -p -o myprog myprog.o
Note: You must specify the -p profiling option during this step to obtain pc sampling information.
% myprog
During execution, profiling data is saved in the file mon.out. You can run the program several times, altering the input data, to create multiple profile data files. You can also use the environment variable PROFDIR as explained in "Creating Multiple Profile Data Files."
% prof -pcsample myprog mon.out
prof extracts information from mon.out and prints it in an easily readable format. If mon.out exists, it is overwritten. Therefore, rename each mon.out to save its output.
Figure 4-1 : How pc Sampling Works